package Lab2.Exc3;

public class Student extends Person {
    private static final String[] STATUS = {"freshmen, sophomore, junior, senior"};
    private String status;

    public void setStatus(String s) {
        try {
            switch (s.toLowerCase().trim()) {
                default:
                    throw new IllegalArgumentException("invalid status");
                case "freshmen":
                    status = "freshmen";
                case "sophomore":
                    status = "sophomore";
                case "junior":
                    status = "junior";
                case "senior":
                    status = "senior";
            }
        } catch(IllegalArgumentException e){
            System.out.println("Arguments incorrect, got "+e.getMessage()+": "+s);
        }
    }

    public Student(String name, String status) {
        super(name);
        setStatus(status);
    }

    public Student(String name) {
        super(name);
    }

    @Override
    public String toString() {
        return "Class: Student, name: " + this.getName() + ", stage: " + status;
    }
}
